<template>
 	<xm-task-edit v-loading="load.list" v-if="xmTaskDb&&xmTaskDb.id" :formData="xmTaskDb"/>
 </template>

<script> 
	 
	import {  getTaskDetail } from '@/api/xm/core/xmTask';
	import { mapState } from 'pinia'
import { defineAsyncComponent } from 'vue';
import { useUserStore } from '@/store/modules/user';  

	export default {  
		props:['xmTask','reload','visible'],
		computed: {
		    ...mapState(useUserStore,[
		      'userInfo','roles'
				]), 
		}, 
		data() {
			return { 
				load:{list:false},
				 xmTaskDb:null, 
				 showInfo:false,
			}
		},//end data
		methods: { 
			  
			getTaskDetail(id){ 

				if(!id){
					this.xmTaskDb=null
					return;
				}
				
					this.load.list=true;
					getTaskDetail({id:id}).then(res=>{
					
					this.load.list=false;
					 var tips = res.tips;
					 if(tips.isOk){
						 this.xmTaskDb=res.data
					 }else{

					 }
				 })
			 }
			
		},//end methods
		components: {  
			XmTaskEdit:defineAsyncComponent(()=>import("./XmTaskEdit.vue")),
			//在下面添加其它组件
		},  
		mounted() {  
			  if(this.reload && this.xmTask && this.xmTask.id){
					this.getTaskDetail(this.xmTask.id)
				}else if(this.xmTask?.id){
					this.xmTaskDb=this.xmTask
				}
		}
	}
</script>

<style scoped />